<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>工厂函数</title>
	</head>
	<body>
		
	</body>
</html>
<script>
	//造人函数
	function person(name, age, gender) {
		//创建一个空对象
		var per = {};

		per.name = name;
		per.age = age;
		per.gender = gender;

		per.info = function(){
			console.log(this.name + "年龄" + this.age + "性别" + this.gender);
		};
		return per;
	}

	var per1 = person("小明", 22, "男");
	var per2 = person("小雪", 20, "女");
	console.log(per1.name,per1.age,per1.gender);
	per1.info();
	console.log(per2.name,per2.age,per2.gender);
	per2.info();



</script>